<%= form_with(model: subcategory, local: true) do |form| %>
  <% if subcategory.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(subcategory.errors.count, "error") %> prohibited this subcategory from being saved:</h2>

      <ul>
      <% subcategory.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= form.label :name %>
    <%= form.text_field :name %>
  </div>

  <div class="field">
    <%= form.label :category_id %>
    <%= form.collection_select :category_id, Category.all, :id, :name, :prompt => 'Select One' %>

  </div>

  <div class="actions">
    <%= form.submit %>
  </div>
<% end %>
